package com.sdry.service.jyy;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sdry.mapper.jyy.TempMapper;
import com.sdry.model.jyy.Temp;
import com.sdry.model.jyy.TempExample;
import com.sdry.model.jyy.TempExample.Criteria;

@Service
public class TempServiseImpl implements TempServise{

	@Resource
	private TempMapper tempMapper;
	
	@Override
	public void insert(Temp temp) {
		tempMapper.insert(temp);
	}

	@Override
	public List<Temp> selectByNumber(String number) {
		TempExample example = new TempExample();
		Criteria createCriteria = example.createCriteria();
		
		if(number != "" && number != null) {
			createCriteria.andNumberEqualTo(number);
		}
		
		return tempMapper.selectByExample(example);
	}

	@Override
	public void delete(String number) {
		TempExample example = new TempExample();
		Criteria createCriteria = example.createCriteria();
		
		if(number != "" && number != null) {
			createCriteria.andNumberEqualTo(number);
		}
		tempMapper.deleteByExample(example);
	}

	@Override
	public int countByNumber(String number) {
		TempExample example = new TempExample();
		Criteria createCriteria = example.createCriteria();
		
		if(number != "" && number != null) {
			createCriteria.andNumberEqualTo(number);
		}
		
		return tempMapper.countByExample(example);
	}
}
